/*
 ============================================================================
 Name        : motion-estim.c
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

#include "frame.h"

int main (){
	int xRow, yCol, rRow, sCol;
	register int rs1, rs2, rt;
	int sad;

	for(xRow=0; xRow<64; xRow=xRow+16){
		for(yCol=0; yCol<160; yCol=yCol+16){
			sad = 0;
			for(rRow=0; rRow<480; rRow=rRow+16){
				if(xRow+rRow >= 480)
					break;
				for(sCol=0; sCol<640; sCol=sCol+16){
					if(yCol+sCol >= 160)
						break;
					rs1 = frameA[xRow][yCol];
					rs2 = frameB[xRow+rRow][yCol+sCol];
					__asm__("SAD %1, %2, %0":"=r"(rt):"r"(rs1), "r"(rs2));
					sad += rt;
				}
			}
		}
	}

	return 0;
}

